<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>您需要登录后才可以使用本功能</title>
<link href="../../css/login/font/css/font-awesome.min.css" rel="stylesheet">
<link href="../../css/login/login.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../../js/jquery/jquery-1.6.2.min.js" charset="utf8"></script>
<script type="text/javascript" src="../../js/jquery/jquery.supersized.min.js"  charset="utf8"></script>
<script type="text/javascript" src="../../js/jquery/jquery.progressBar.js"  charset="utf8"></script>
<script type="text/javascript" src="../../js/login/common.js"  charset="utf8"></script>
<script type="text/javascript" src="../../js/sys_common.js"  charset="utf8"></script>
<script type="text/javascript" src="../../js/cookie.js"  charset="utf8"></script>

</head>
<body>
 <!--v3-v12-->
<div class="login-layout">
  <div class="top">
    <h5><em></em></h5>
    <h2>众聚福平台管理中心</h2>
  </div>
  <form method="post" id="form_login">
    <div class="lock-holder">
      <div class="form-group pull-left input-username">
          <label>账号</label>
          <input name="username" id="username" autocomplete="off" type="text" class="input-text" value="admin" required="true">
      </div>
      <i class="fa fa-ellipsis-h dot-left"></i> <i class="fa fa-ellipsis-h dot-right"></i>
      <div class="form-group pull-right input-password-box">
          <label>密码</label>
          <input name="password" id="password" class="input-text" value="123456" autocomplete="off" type="password" required pattern="[\S]{6}[\S]*" title="密码不少于6个字符">
      </div>
    </div>
    <div class="avatar"><img src="../../images/login/admin.png" alt=""></div>
    <div class="submit"> <span>
      <div class="code">
        <div class="code-img">
        	<img src="" name="codeimage" id="codeimage" border="0"/>
        </div>
        <a href="JavaScript:void(0);" id="hide" class="close" title="关闭"><i></i></a>
        <a href="JavaScript:void(0);" id="changeCode" class="change" title="看不清,点击更换验证码"><i></i></a> </div>
      <input name="captcha" type="text" required class="input-code" id="captcha" placeholder="输入验证" pattern="[A-z0-9]{4}" title="验证码为4个字符" autocomplete="off" value="" >
      </span> <span>
      <input name="nchash" type="hidden" value="728d0497" />
      <input name="" class="input-button btn-submit" type="button" value="登录">
      </span> </div>
      <div class="submit2"></div>
  </form>
  <div class="bottom">
  </div>
</div>
<script>


$(function(){
	
	  	
        $.supersized({

        // 功能
        slide_interval     : 4000,    
        transition         : 1,    
        transition_speed   : 1000,    
        performance        : 1,    

        // 大小和位置
        min_width          : 0,    
        min_height         : 0,    
        vertical_center    : 1,    
        horizontal_center  : 1,    
        fit_always         : 0,    
        fit_portrait       : 1,    
        fit_landscape      : 0,    

        // 组件
        slide_links        : 'blank',    
        slides             : [    
                                 {image : '../../images/login/1.jpg'},
                                 {image : '../../images/login/2.jpg'},
                                 {image : '../../images/login/3.jpg'},
								 {image : '../../images/login/4.jpg'},
								 {image : '../../images/login/5.jpg'}
                       		 ]

    });
	//显示隐藏验证码
    $("#hide").click(function(){
        $(".code").fadeOut("slow");
    });
	$("#changeCode").click(function(){
   		var ssrc1 = getRootPath()+ "/rest/download/file"+'/?s='+Math.random() ;
   		$("#codeimage").attr("src", ssrc1);
    });
    $("#captcha").focus(function(){
        $(".code").fadeIn("fast");
    });
    //跳出框架在主窗口登录
   if(top.location!=this.location)	top.location=this.location;
    $('#user_name').focus();
    if ($.browser.msie && ($.browser.version=="6.0" || $.browser.version=="7.0")){
        window.location.href='../../pages/access/ie6update.html';
    }
    $("#captcha").nc_placeholder();
	//动画登录
    $('.btn-submit').click(
    		
    		function(e){
    			var username =  $("#username").val(); 
          	  	var password =  $("#password").val();
          	  	var captcha  =  $("#captcha").val();
          	  	if(username == "" || password == ""){
    				alert("用户名或密码不能为空");
    				window.location.reload();//刷新当前页面.
          	  	}else if(captcha == ""){
          	  		alert("验证码不能为空");
					window.location.reload();//刷新当前页面.
          	  	}else{
          	  		$('.input-username,dot-left').addClass('animated fadeOutRight')
	            	$('.input-password-box,dot-right').addClass('animated fadeOutLeft')
	            	$('.btn-submit').addClass('animated fadeOutUp')
	            	setTimeout(function () {
	                      $('.avatar').addClass('avatar-top');
	                      $('.submit').hide();
	                      $('.submit2').html('<div class="progress"><div class="progress-bar progress-bar-success" aria-valuetransitiongoal="100"></div></div>');
	                      $('.progress .progress-bar').progressbar({
	                          done : function() {
	                        	  
	                        	  var root_path = getRootPath();
	                        	  var params={"username":username,"password":password,"captcha":captcha};
	                        	  params = JSON.stringify(params)
	                        	  $.ajax({
	                        			type : 'post',
	                        			url : root_path+'/rest/access/admin_login',
	                        			data : params, // 传给action的参数
	                        			async:false,
	                        			success : function(data) {
	                        				//var suc_data = eval('('+ data +')');
	                        				if(data.errCode=="0"){
	                        					Setcookie("TuserID",data.TuserID);
	                        					window.location.href= getRootPath()+"/pages/index.html";
	                        				}else{
	                        					alert(data.errMsg);
	                        					window.location.reload();//刷新当前页面.
	                        				}
	                        			},
	                        			error: function(XMLHttpRequest, textStatus, errorThrown) {
	                        				 alert(XMLHttpRequest.status);
	                        				 alert(XMLHttpRequest.responseText);
//	                        				 alert(textStatus);
	                        			}
	                        		});
	                          }
	                      }); 
	              },
	          300);
          	  	}
	            
          }
    );

    // 回车提交表单
    $('#form_login').keydown(function(event){
        if (event.keyCode == 13) {
            $('.btn-submit').click();
        }
    });
     
    var ssrc = getRootPath()+ "/rest/download/file";
   	$("#codeimage").attr("src", ssrc); 
   	
});

</script>
</body>
</html>